package com.bwie.controller;

import com.bwie.bean.User;
import com.bwie.service.StuService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@Controller
public class UsersController {

    @Resource
    private StuService stuService;


    @RequestMapping("login.do")
    public String login(User user,HttpSession session){

        User login=stuService.login(user);
       if (login!=null){
           session.setAttribute("user",login);
           if (login.getZt()>0){
               return "redirect:list.do";
           }else{
               return "redirect:list.do";
           }
       }else{
           return "redirect:index.jsp";
       }

    }
}

















